import 'package:time/data/start_up_bean.dart';
import 'package:time/data/version_bean.dart';

class EntityFactory {
  static T? generateOBJ<T>(String className, dynamic json) {
    if (className == "String") {
      return json as T;
    } else if (className == "VersionBean") {
      return VersionBean.fromJson(json) as T;
    } else if (className == "StartUpBean") {
      return StartUpBean.fromJson(json) as T;
    } else if (className == "bool") {
      return json as T;
    }
  }

  static List<T>? generateOBJList<T>(String className, dynamic json) {
    if (json == null) return null;
    return (json as List)
        .map((jsonItem) => generateOBJ<T>(className, jsonItem)!)
        .toList();
  }
}
